<?php
defined('_JEXEC') or die('Restricted access');
global $mainframe;

require_once(JApplicationHelper::getPath('front_html'));
$task = JRequest::getVar('task');
switch($task) {
    case 'list':
    default:
    	listHotel($option);
    	break;
}

function listHotel($option) {
    jimport('smarty.smarty');    
    $db = JFactory::getDBO();
    jimport('hotel.business.HotelBusiness');
    $hobj =& HotelBusiness::getInstance($db);
    $details = $hobj->listHotel();    
    $smarty = new JSmarty();
    $smarty->template_dir = getCompDir() . DS . 'templates';
    HTML_hotel::displayHotelList($smarty, $details, $option);
}

function getCompDir() {
    $path = JApplicationHelper::getPath('class');
    $parts = explode(DS, $path);
    array_pop($parts);
    $path = implode(DS, $parts);
    return $path;
}

?>